//
//  CommonConfigure.h
//
//  Created by hamentD on 16/1/25.
//  Copyright © 2016年 blk. All rights reserved.
//


#define kIOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) // 判断是否是IOS8的系统
#define kIOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) // 判断是否是IOS8的系统
#define kIOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) // 判断是否是IOS8的系统

// 3.是否为4inch
#define kFourInch ([UIScreen mainScreen].bounds.size.height == 568)

#define KWCurrentWindow [UIApplication sharedApplication].keyWindow

/*----------路径相关-------------*/
#define kDocumentDirectory  [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define kLibraryDirectory   [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define kCachesDirectory    [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] //这个不会被itunes备份
#define kTempDirectory      NSTemporaryDirectory()

/*
 ----------获取Mainbundle 里面文件路径----------
 */
#define kFileBundlePath(file,extention) [[NSBundle mainBundle]pathForResource:file ofType:extention]


//动态获取设备高度
#define kIPHONE_HEIGHT [UIScreen mainScreen].bounds.size.height
//动态获取设备高度
#define kIPHONE_WIDTH [UIScreen mainScreen].bounds.size.width

#define kNavHeight 44.0
#define kStatusBarHeight 20.0

//重新设定view的Y值
#define setFrameY(view, newY) view.frame = CGRectMake(view.frame.origin.x, newY, view.frame.size.width, view.frame.size.height)
#define setFrameX(view, newX) view.frame = CGRectMake(newX, view.frame.origin.y, view.frame.size.width, view.frame.size.height)
#define setFrameH(view, newH) view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, newH)


//取view的坐标及长宽
#define W(view)    view.frame.size.width
#define H(view)    view.frame.size.height
#define X(view)    view.frame.origin.x
#define Y(view)    view.frame.origin.y

//常用对象
#define kAPPDELEGATE ((AppDelegate *)[UIApplication sharedApplication].delegate)

//
#define kIOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

// 单例
#undef	AS_SINGLETON
/**
 *  申明单例
 *
 *  @param __class
 *
 *  @return
 */
#define AS_SINGLETON( __class ) \
+ (__class *)sharedInstance;

#undef	DEF_SINGLETON
/**
 *  实现单例
 *
 *  @param __class
 *
 *  @return
 */
#define DEF_SINGLETON( __class ) \
+ (__class *)sharedInstance \
{ \
static dispatch_once_t once; \
static __class * __singleton__ = nil; \
dispatch_once( &once, ^{ __singleton__ = [[__class alloc] init]; } ); \
return __singleton__; \
}

//设置userdefaults里面某key的值
#define kSetUserDefaultsForKey(key,value) [[NSUserDefaults standardUserDefaults] setObject:value forKey:key]
//获取userdefaults里面某key的值
#define kGetUserDefaultsWithKey(key)  [[NSUserDefaults standardUserDefaults] objectForKey:key]
//移除userdefaults的值
#define kRemoveUserDefaultsObjectForKey(key)  [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]

#define kUserDefaultsSynchronize  [[NSUserDefaults standardUserDefaults] synchronize]

//注册本地通知
#define kNSNotificationCenter(key,object) [[NSNotificationCenter defaultCenter] postNotificationName:key object:object];


#define kIsKindOfString(obj) [obj isKindOfClass:[NSString class]]
#define kIsKindOfArray(obj) [obj isKindOfClass:[NSArray class]]

#define kIsKindOfDictionary(obj) [obj isKindOfClass:[NSDictionary class]]

//设置颜色
#define kSetCOLOR(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

//设置颜色与透明度
#define kSetCOLORAL(rgbValue, al) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:al]

//设置间隔线的颜色
#define kLineColor kSetCOLOR(0xf0f0f0)

#define k18Space  18.0
#define k12Space  12.0
#define k10Space  10.0
#define k8Space   8.0

//导航栏颜色
#define kNavBarColor kSetCOLORAL(0x111111,0.9)

#define kNavBarBackgroundColor kSetCOLORAL(0xffffff,1)

//背景色颜色
#define kBackgroundColor kSetCOLOR(0xf4f4f4)
#define kWhiteColor kSetCOLOR(0xffffff)
#define kBaseColor kSetCOLOR(0x03b980)

//字体大小
#define kSP18Font                            [UIFont systemFontOfSize:18.0]
#define kSP17Font                            [UIFont systemFontOfSize:17.0]
#define kSP16Font                            [UIFont systemFontOfSize:16.0]
#define kSP15Font                            [UIFont systemFontOfSize:15.0]
#define kSP14Font                            [UIFont systemFontOfSize:14.0]
#define kSP13Font                            [UIFont systemFontOfSize:13.0]
#define kSP12Font                            [UIFont systemFontOfSize:12.0]
#define kSP11Font                            [UIFont systemFontOfSize:11.0]

/*
 ----------字符串处理--------
 */

/*检查字串*/
#define kCHECKSTR(str) (str == nil || [str isKindOfClass:[NSNull class]] || str.length == 0)? @"" : str

//检查日期格式字串
#define  kInitlizSyncTimeStamp @"0000-00-00 00:00:00"
#define kCHECKDateSTR(str) (str == nil || [str isKindOfClass:[NSNull class]])? InitlizSyncTimeStamp : str

//本地化字符串
#define kUSELocalString(A) NSLocalizedString(A,nil)

/*
 ----------debug模式下使用--------
 */
#ifdef DEBUG
#define DDLog(fmt, ...) NSLog((fmt), ##__VA_ARGS__);
#define debugLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@" %s ,%d",__FUNCTION__,__LINE__);
#define debugReleaseMark() NSLog(@"Release %s ,%d",__FUNCTION__,__LINE__);

#else
#define DDLog(...)
#define debugLog(...)
#define debugMethod()
#define debugReleaseMark()
#endif

#define kSaveHeaderIcon @"SaveHeaderIcon"
#define kSaveNickName @"SaveNickName"
#define kSaveSex @"SaveSex"

#define kUserInfo @"UserInfo"

#define kFoodTypeArray @"FoodTypeArray"
#define kBusinessCenterArray @"BusinessCenterArray"

#define kCurrentLanguage @"currentLanguageKey"
#define kZHHantCN @"zh-Hant" //繁体
#define kZHHansCN @"zh-Hans" //简体

//服务主机  默认测试
#define kRequestHost @"RequestHost"


//// 默认位置经度 (澳门威尼斯人酒店)
//#define kUserDefaultLontitude 113.5718590000
//// 默认位置纬度 (澳门威尼斯人酒店)
//#define kUserDefaultLatitude 22.1505480000

#define kTableViewFirstHeaderRito 210/375.0

///默认最小的距离
#define kDefaultMeters  100.0

// 极光推送AppKeys
#define kJPushAppKey  @"1d563f8880e79120ab21fd27"

// 彩票网址引导的域名
#define kLotteryDomainName  @"cpcp4411.com"

